﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

public partial class Admin_Service_adddept : ManagePageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string deptname = Request.Form["deptname"].Trim();

        if (!IsPostBack) {
            string result = "0";
            int maxid = new Exam.Core.DAL.Department().AddReturnId(deptname);
            if (maxid>0)
            {
                //
                string mydeptid = isTheMe.DepartmentID.Trim(',');
                mydeptid += "," + maxid;
                mydeptid = mydeptid.Trim(',');
                bool res = new Exam.Core.DAL.Master().EditDept(mydeptid,isTheMe.MasterID.Trim());
                if (res) {
                    isTheMe.DepartmentID = mydeptid.Trim();
                    //重新保存一下cookies
                    UserCookiesManage.SaveManageCookies(isTheMe);
                    result = "1";
                }
            }
            Response.Write(result);
            Response.End();
        }
    }
}